<template>
    <span style="line-height: 21px;">
        <span style="color:#aaa;">RSRP：</span>
        <template v-if="cell_rsrp">
            <span v-if="cell_rsrp > -80" style="color:#19be6b">{{ cell_rsrp }} dBm<span if="!!gen">（{{ gen }}）</span></span>
            <span v-else-if="cell_rsrp > -100" style="color:#f59f00">{{ cell_rsrp }} dBm<span if="!!gen">（{{ gen }}）</span></span>
            <span v-else style="color:#eb0303">{{ cell_rsrp }} dBm<span if="!!gen">（{{ gen }}）</span></span>
        </template>
        <template v-else>
            <span style="color:#eb0303">- dBm</span>
        </template>
    </span>
</template>

<script>

export default {
    name: "CellRSRPLabel",
    props: {
        cell_rsrp: Number,
        cell_gen: String,
    },
    computed: {
        gen() {
            if (!this.cell_gen) {
                return ""
            }
            // 如果是数字的话，则直接数字加上G
            if (isNaN(this.cell_gen) == false) {
                return this.cell_gen + "G"
            }
            if (this.cell_gen.toLowerCase().includes("lte")) {
                return "4G"
            } else if (this.cell_gen.toLowerCase().includes("sa")) {
                return "5G"
            } else {
                return ""
            }
        }
    }

}
</script>